﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TwKarma.Web.App
{
    public class AtStarHandler : IHttpHandler
    {
        #region IHttpHandler Members

        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            string lastSegment = HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length - 1];

            // Ignore file requests (file.ext)
            if (lastSegment.IndexOf('.') != -1)
                return;

            if (lastSegment.StartsWith("@"))
                HttpContext.Current.Server.Transfer("Profile.aspx?For=" + lastSegment);
        }

        #endregion
    }
}